package com.itheima.controller;

import org.apache.catalina.connector.Response;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
public class CookieSessionController {
    /*
    *
    * 原始请求对象以及响应数据：
    * request:原始请求对象--这里是tomcat创建的，Spring中也可以使用
    * response:原始响应对象
    * */
    public void test(HttpServletRequest request  ,HttpServletResponse response) throws IOException {
//获取请求数据
     String id =    request.getParameter("id");
        String name =    request.getParameter("name");

        //获取请求头
       String headder = request.getHeader("User-Agent");
        System.out.println(headder);
        //获取请求路径
        request.getRequestURI();
        //响应数据
        response.getWriter().write("{}");
        response.setContentType("application/json");
    }




}
